<table class="show return-items-table table table-condensed index">
  <thead>
    <tr>
      <th scope="col"><%= Spree.t(:product) %></th>
      <th scope="col"><%= Spree.t(:pre_tax_amount) %></th>
      <th scope="col"><%= Spree.t(:preferred_reimbursement_type) %></th>
      <th scope="col"><%= Spree.t(:exchange_for) %></th>
      <th scope="col"><%= Spree.t(:acceptance_errors) %></th>
      <% if show_decision %>
        <th scope="col"></th>
      <% end %>
    </tr>
  </thead>
  <tbody>
    <% return_items.each do |return_item| %>
      <tr>
        <td>
          <%= if return_item.inventory_unit
            render "spree/admin/variants/variant",
            variant: return_item.inventory_unit.variant
          end %>
        </td>
        <td>
          <%= return_item.display_pre_tax_amount %>
        </td>
        <td>
          <%= reimbursement_type_name(return_item.preferred_reimbursement_type) %>
        </td>
        <td>
          <%= return_item.exchange_variant.try(:exchange_name) %>
        </td>
        <td>
          <%= if return_item.acceptance_status_errors.present?
            return_item.acceptance_status_errors
          end %>
        </td>
        <% if show_decision %>
          <td class='actions d-flex gap-2'>
            <% if can?(:accept, return_item) %>
              <%= button_to [:admin, return_item], { class: 'with-tip display-inline btn btn-primary btn-sm', params: { "return_item[acceptance_status]" => 'accepted' }, title: Spree.t(:accept), method: 'put' } do %>
                <%= Spree.t(:accept) %>
              <% end %>
            <% end %>
            <% if can?(:reject, return_item) %>
              <%= button_to [:admin, return_item], { class: 'with-tip display-inline btn btn-danger btn-sm', params: { "return_item[acceptance_status]" => 'rejected' }, title: Spree.t('actions.reject'), method: 'put' } do %>
                <%= Spree.t("actions.reject") %>
              <% end %>
            <% end %>
          </td>
        <% end %>
      </tr>
    <% end %>
  </tbody>
</table>
